﻿using UnityEngine;

namespace FlowControl
{
    class FlowBase : IFlowBase
    {   
        //激活的当前时间
		private float activeTime;

		//从激活开始经过的时间
        protected float passTime;

        public bool IsActive { get; set; }

        public bool IsComplete { get; set; }

        public bool IsDestroy { get; set; }

        public string Name { get; set; }

        public virtual void FlowUpdate(float duringTime)
        {
            passTime = duringTime - activeTime;
        }

        public virtual void Activate()
        {
            IsActive = true;
            IsComplete = false;
            activeTime = Time.realtimeSinceStartup;
        }

        public void Destroy()
        {
            IsComplete = true;
            IsDestroy = true; 
        }
    }
}